package com.leyou.common.advice;

import com.leyou.common.advice.exception.LyException;
import com.leyou.common.vo.ExceptionResult;
import org.apache.tomcat.jni.Status;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

@ControllerAdvice
public class CommonExceptionHandler {
    @ExceptionHandler
    public ResponseEntity<ExceptionResult> handlerException( LyException e){

        return  ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ExceptionResult(e.getExceptionEnum()));


    }




}
